package pay

import (
	"context"
	"github.com/gin-gonic/gin"
	"github.com/shopspring/decimal"
)

type Channel int

const (
	AlipayChannel Channel = 1
	WechatChannel Channel = 2
	AppleChannel  Channel = 3
	SandeChannel  Channel = 4
	WeChatPay1    Channel = 5
)

type OrderParams struct {
	Platform     string
	TradeNo      string
	Subject      string
	Amount       decimal.Decimal
	OpenID       string
	PlatformType int64
	NewAmount    int64
	Con          context.Context
}

type NotifyReq struct {
	UserID          string
	TradeNo         string
	AppleProductID  string
	Channel         Channel
	OriginalTradeNo string
	ExTime          int64
	Mark            int64
}

//	BankSerial     string

type SceneInfo struct {
	H5Info        H5Info `json:"h5_info"`
	PayerClientIp string `json:"payer_client_ip"`
}
type H5Info struct {
	Type string `json:"type"`
	//WapURL  string `json:"wap_url"`
	//WapName string `json:"wap_name"`
}
type WxGz struct {
	MerAppID string `json:"mer_app_id"`
	Openid   string `json:"openid"`
}
type WxExtInfo struct {
	SubAppid string `json:"subAppid"`
	UserId   string `json:"userId"`
}
type Payer interface {
	Order(params *OrderParams) (string, error)                        // 下单
	Notify(c *gin.Context, callback func(req *NotifyReq) error) error // 通知
	QueryOrder(OrderID string) (string, error)
	Notification(c *gin.Context, callback func(req *NotifyReq) error) error
}
